package work.shyk.cdp.xmlDemo;

import work.shyk.cdp.xmlDemo.dto.Group;
import work.shyk.cdp.xmlDemo.dto.RepoGroup;

/**
 * description: <br>
 * createTime: 2020/10/2015:31 <br>
 *
 * @author zzh
 */
public class Main {

    public static void main(String[] args) {
        // 创建需要转换的对象
        RepoGroup repoGroup = new RepoGroup();
        Group group = new Group("test", "group", "http://10.238.222.166:8081/nexus/content/groups/test", "test", "maven2", "maven2", "org.sonatype.nexus.proxy.repository.GroupRepository", true);
        repoGroup.setGroup(group);
        System.out.println("---将对象转换成string类型的xml Start---");
        // 将对象转换成string类型的xml
        String str = XMLUtil.convertToXml(repoGroup);
        // 输出
        System.out.println(str);
        System.out.println("---将对象转换成string类型的xml End---");
        System.out.println();
        System.out.println("---将String类型的xml转换成对象 Start---");
        RepoGroup repoGroupTest = XMLUtil.convertXmlStrToObject(RepoGroup.class, str);
        System.out.println(repoGroupTest);
        System.out.println("---将String类型的xml转换成对象 End---");
    }
}
